import axios from "axios"
let r = axios.create({
  baseURL: "http://47.95.192.129:3300/",
  //baseURL: "http://localhost:3300",
})
let requests = {
  get: (url, params) => r.get(url, {params}),
  post: (url, data) => r.post(url, data)
}

r.interceptors.response.use(value => value.data)

export const qqMusicApi = {
  // 为你推荐歌单
  getRecommendPlayList: () => {
    return requests.get("/recommend/playlist/u")
  },


  // 获取歌单
  getSongList: (id) => {
    return requests.get("/songlist", {id})
  },

  // 获取歌曲
  getSongSrc: id => {
    return requests.get("/song/url", {id})
  },

  // 获取歌手信息
  getSingerInfo: id => {
    return requests.get("/singer/desc", {singermid: id})
  },
  // 获取歌手热门歌曲
  getSingerHotSong: (id,page=1, num=20) => {
    return requests.get("/singer/songs", {singermid: id, page, num})

  },
  // 获取歌手专辑
  getSingerAlbum: (id, pageNo=1, pageSize=20) => {
    return requests.get("/singer/album", {singermid:id, pageNo, pageSize})
  },

  // 获取专辑详情
  getAlbumDetail: id => {
    return requests.get("/album", {albummid: id})
  },

  // 获取专辑内歌曲
  getAlbumSongs: id => {
    return requests.get("/album/songs", {albummid: id})
  }
}
